<template>
	<view class="container">

		<!-- TODO 请定义页面结构代码 -->
		<img :src="baseUrl+data.icon" mode="" style="width: 100px; height: 100px;padding-left: 170px;" />
		<view class="item">
			编号：{{data.id}}
		</view>

		<view class="item">
			姓名:{{data.name}}
		</view>

		<view class="item">
			学院：{{data.department}}
		</view>

		<view class="item">
			专业：{{data.major}}
		</view>

		<view class="item">
			电话：{{data.telephone}}
		</view>

		<view class="item">
			邮箱：{{data.email}}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// TODO 请页面数据结构
				"baseUrl": "http://127.0.0.1:8090", // 拼接图片地址：baseUrl+data.icon
				"data": {
					"id": 1,
					"major": "移动应用开发",
					"department": "信息工程学院",
					"name": "张三",
					"telephone": "12345678901",
					"email": "zs@163.com",
					"icon": "/app4/images/01.png"
				}
			}
		},
		onLoad() {
			//TODO 请定义页面逻辑代码，获取同学的信息，更新页面数据this.data
			uni.request({
				url: 'http://127.0.0.1:8090/app4/classmate/findone',
				method: 'POST',
				data: {
					"id": 1
				},
				success: res => {
					if (res.data.success) {
						uni.showToast({
							title: '成功'
						});
						this.data = res.data.data
					} else {
						uni.showToast({
							title: '失败',
							icon: 'none'
						});
					}
				},
				fail: () => {
					uni.showToast({
						title: '失败'
					});
				}
			})
		},
		methods: {

		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}

	.item {
		padding-left: 150px;
	}
</style>